package com.funtl.screw.codegen.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.funtl.screw.codegen.entity.ColumnEntity;
import com.funtl.screw.common.data.permission.ServiceBaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 代码生成器
 *
 * @author Lusifer
 * @since 2023-01-30
 */
public interface GeneratorMapper extends ServiceBaseMapper<ColumnEntity> {

    /**
     * 分页查询表格
     */
    @InterceptorIgnore(tenantLine = "true")
    IPage<Map<String, Object>> queryTable(Page page, @Param("tableName") String tableName);

    /**
     * 查询表信息
     */
    @DS("#last")
    @InterceptorIgnore(tenantLine = "true")
    Map<String, String> queryTable(@Param("tableName") String tableName, String dsName);

    /**
     * 分页查询表分页信息
     */
    @DS("#last")
    @InterceptorIgnore(tenantLine = "true")
    IPage<ColumnEntity> selectTableColumn(Page page, @Param("tableName") String tableName,
                                          @Param("dsName") String dsName);

    /**
     * 查询表全部列信息
     */
    @DS("#last")
    @InterceptorIgnore(tenantLine = "true")
    List<ColumnEntity> selectTableColumn(@Param("tableName") String tableName, @Param("dsName") String dsName);

    /**
     * 查询表全部列信息
     */
    @DS("#last")
    @InterceptorIgnore(tenantLine = "true")
    List<Map<String, String>> selectMapTableColumn(@Param("tableName") String tableName, String dsName);

}
